'''
Created on 26/03/2009

@author: eh01
'''
from ConfigParser import ConfigParser

HUB_USERNAME = 'hub_username'
HUB_PASSWORD = 'hub_password'
HUB_BASE_URL = 'hub_base_url'
NODE_ID = 'current_node_id'
SPEAR_HOST_ID = 'spear_hostid'
SPEAR_HOST_PASSWORD = 'spear_hostpassword'
CA_CERT = 'ca_cert'
CLIENT_CERT = 'client_cert'        
CLIENT_CERT_PASSWORD = 'client_cert_password'
HTTP_SERVER_PORT = 'http_server_port'
SPEAR_A2A_BASE_URL = 'spear_a2a_base_url'
HUB_WAIT = 'hub_wait'
NUMBER_OF_EVENT_DISPATCHERS = 'number_of_event_dispatchers'
ALLOW_KEYBOARD_INTERRUPT = 'allow_keyboard_interrupt'
APPLICATION_NAME = "application_name"

class NodeConfig(object):
    '''
    IM Configuration Class. This is a Singleton Class
    '''
    __cfg_parser = None
    
    def __init__(self, absolute_path):
        '''
        Constructor
        '''
        self.__cfg_parser = ConfigParser()
        self.__cfg_parser.read(absolute_path)
     
    def get(self, key):
        return self.__cfg_parser.defaults()[key]
    
    def keys(self):
        return self.__cfg_parser.defaults().keys()